<template>
  <div class="item" @click="ClickItem">
    <div class="left">
      <img :src="data.img" alt="" />
      <div class="text">
        <span class="name">{{ data.name }}</span>
        <span class="value">{{ data.subName }}</span>
      </div>
    </div>
    <div class="right">
      <span :class="{ color1: data.type == 1, color2: data.type == 2 }">{{
        data.value
      }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: Object,
  },
  methods: {
    ClickItem() {
      this.$emit("click-item", this.data);
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  display: flex;
  background: #fff;
  padding: 22px 17px;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border-radius: 8px;
  .left {
    flex: 1;
    img {
      width: 36px;
      height: 36px;
      border-radius: 50%;
    }
    .text {
      display: inline-block;
      margin-left: 17px;
      .name {
        display: block;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 16px;
        color: #272b2d;
      }
      .value {
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 12px;
        color: #676b6b;
      }
    }
  }
  .color1 {
    color: #ffa940;
  }
  .color2 {
    color: #00c37d;
  }
}
</style>
